博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
js 多选选择删除数据
阅读量:6991 次
发布时间:2019-06-27

本文共 3375 字,大约阅读时间需要 11 分钟。

按了顶上的删除(多项删除)

单列复选框删除 js语句

1 删除
1 

 

多列复选框删除js语句

先在table外套个form表单 并且指定id,其中给复选框指定name 和 value

<td><input type="checkbox" name="ids" value="${customer.id}"/></td>

1     
2
3 ............4
5
1     

参考

1 <%@ page language="java" contentType="text/html; charset=utf-8" 2     pageEncoding="utf-8"%> 3 <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <%@taglib uri="http://www.WFReduceContent.com" prefix="reduce"%> 5  6  7  8 
9 Insert title here10 11 12
13
14
15
16
17
18
添加 多重删除
19
33
20
21
22
23
24
25
26
27
28
29
30
31
32
34
35
36
37
38
39
40
41
42
43
45
46 47
选择 姓名 性别 生日 电话 email 爱好 类型 描述 操作
${customer.name} ${customer.gender=="1"?"男":"女"} ${customer.birthday} ${customer.cellphone} ${customer.email} ${customer.hobby} ${customer.type}
编辑44 删除
48
84
85 86 87
View Code
1 package cn.itcast.Controller; 2  3 import java.io.IOException; 4 import javax.servlet.ServletException; 5 import javax.servlet.annotation.WebServlet; 6 import javax.servlet.http.HttpServlet; 7 import javax.servlet.http.HttpServletRequest; 8 import javax.servlet.http.HttpServletResponse; 9 10 import cn.itcast.service.CustomerService;11 import cn.itcast.service.impl.CustomerServiceImpl;12 13 public class DelCustomerServlet extends HttpServlet {14     private static final long serialVersionUID = 1L;15     private CustomerService service= new CustomerServiceImpl();16     public DelCustomerServlet() {17         super();18     }19 20     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {21         String method=request.getParameter("method");22         if("delMultiple".equals(method))            //多重删除23         {24             String ids[]=request.getParameterValues("ids");25             if(null!=ids&&ids.length>0)26                 for(String id:ids)27                     service.delCustomerById(id);28             request.getRequestDispatcher("ShowAllCustomer").forward(request, response);29             return;30         }31         //单条删除32         String customerId=request.getParameter("customerId");33         System.out.println( "servlet"+customerId);34         service.delCustomerById(customerId.trim());35         request.getRequestDispatcher("ShowAllCustomer").forward(request, response);36     }37     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {38         this.doGet(request, response);39     }40 41 }
View Code

 

转载于:https://www.cnblogs.com/friends-wf/p/3745159.html

你可能感兴趣的文章
VUE3)操作cookie
查看>>
python 文件处理总结
查看>>
jmeter和loadrunner测试结果差异大-web页面静态资源下载
查看>>
一个长期颈椎问题的工薪阶层关于颈椎的康复和预防的心得
查看>>
jsp中${pageContext.request.contextPath}的意思
查看>>
搭建Android开发环境
查看>>
iOS开发 引用第三方库出现duplicate symbol时的处理方法
查看>>
解放iOS&Android程序猿:Testin云测试破1000万次
查看>>
npm常用命令
查看>>
第十二章:二叉查找树(3)
查看>>
HTTP状态码理解
查看>>
C++/CLI 编程——使用 for each 循环存取字符串中的字符
查看>>
POJ 3111 K Best 贪心 二分
查看>>
SQL常识
查看>>
随机数产生函数的范围转换
查看>>
java 跨域问题解决方法
查看>>
示例页面
查看>>
关于Java构造器
查看>>
正确理解这四个重要且容易混乱的知识点:异步,同步,阻塞,非阻塞,5种IO模型...
查看>>
显示当前分与历史最高分数
查看>>